package com.github.baichuan.application.scaffold.rest.gateway.security;

import com.github.baichuan.web.security.Authorization;
import com.github.baichuan.web.security.PrincipalPayload;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

import java.util.Set;

@Getter
@Setter
@Builder
public class Principal implements PrincipalPayload {
    private String uid;

    private String name;

    private String memberType;

//    private String tenant;

    private String orgBranch;

    private Set<String> authorizations;

    @Override
    public String memberUid() {
        return uid;
    }

    @Override
    public boolean check(Authorization authorization) {
        return authorizations.contains(authorization);
    }
}
